/*
	Copyright (C) 2009 Salil Bhagurkar
	
	This file is part of ViSE
	
	ViSE is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	ViSE is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public License
	along with ViSE.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _SCHED_H_
#define _SCHED_H_


/*Scheduler for scheduling vm tasks. Currently non-preemptive to avoid synchronization complications. We don't need preemption for user mode, as we can it is a vm and everything is in our control*/


struct task {
	char up;
	char first_run;
	void *stack; //Stack allocation
	void *stack_ptr; //Current stack pointer
	struct node_fs *fs;
	struct node_fs *editing; //This application is being edited
	struct node *editing_node; //This node in 'editing' application is being edited
	void *task_data;
};

void *sched_get_task_data(struct node_fs *task_fs);
void sched_set_task_data(struct node_fs *task_fs, void *task_data);

struct node_fs *get_editing();
int set_editing(char*);
int set_editing_noparse(struct node_fs *n);

int set_editing_node(struct node *node);
struct node *get_editing_node();

extern struct task *current;

#endif
